//
//  SLHomeCollectionViewCell.m
//  StarLight
//
//  Created by apple on 16/7/31.
//  Copyright © 2016年 Duke.Wu. All rights reserved.
//

#import "SLHomeCollectionViewCell.h"

@interface SLHomeCollectionViewCell()

@property (nonatomic ,strong) UIImageView *iconImg;

@property (nonatomic ,strong) UILabel *titleName;

@end

@implementation SLHomeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self addSubview:self.iconImg];
        [self addSubview:self.titleName];
        
        
        
        [self.titleName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self).with.offset(-16 *MIX_H);
            make.centerX.equalTo(self);
            make.height.mas_equalTo(16);
        }];
        
        [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.titleName.mas_top).with.offset(-16 *MIX_H);
            make.centerX.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(34 , 34));
        }];
        
    }
    return self;
}

- (void)cellForData:(NSString *)name img:(NSString *)img
{
    self.titleName.text = name;
    self.iconImg.image = IMG(img);
}


- (UIImageView *)iconImg
{
    if (!_iconImg) {
        _iconImg = [UIImageView new];
        _iconImg.image = IMG(@"ic_index_fujinzhaohuo");
    }
    return _iconImg;
}
- (UILabel *)titleName
{
    if (!_titleName) {
        _titleName = [UILabel new];
        _titleName.text = @"附近找货";
        _titleName.font = pFont(@"PingFang-SC-Medium",16);
        _titleName.textColor = RGBCOLOR(38, 38, 38);
    }
    return _titleName;
}

@end
